package com.yugao.fintech.antelope.system.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yugao.fintech.antelope.base.model.BasePO;
import com.yugao.fintech.antelope.base.tenant.core.DataIsolation;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 角色和菜单关联 sys_role_menu
 * 

 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("sys_role_menu")
@DataIsolation(filterTenant = true, tableName = "sys_role_menu")
public class SysRoleMenu extends BasePO {
    /**
     * 角色ID
     */
    private Long roleId;

    /**
     * 菜单ID, 如果不和菜单发生关联就设置成0
     */
    private Long menuId = 0L;

    /**
     * 场景ID
     */
    private Long sceneId;

    /**
     * 资源操作, 如果资源操作不为空则为接口资源操作
     */
    private String resourceAction;

    /** 数据规则ids */
    private String dataRuleIds;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createdAt;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updatedAt;

    public static LambdaQueryWrapper<SysRoleMenu> lqw() {
        return Wrappers.lambdaQuery();
    }

    public static LambdaUpdateWrapper<SysRoleMenu> luw() {
        return Wrappers.lambdaUpdate();
    }
}
